<template>
  <div>
    {{ studentId }}
  </div>
</template>

<script>
export default {
  name: 'StudentView',
  data() {
    return {
      studentId: ''
    }
  },
  created() {
    this.getStudentId();
  },
  watch: {
    '$route.params.id': function(newid) {
      this.getStudentId();
    }
  },
  methods: {
    getStudentId() {
      const studentid = this.$route.params.id;
      console.log(studentid);
      this.studentId = studentid;
    }
  }
}
</script>